package hotel.callback.oversea.config;

import lombok.extern.slf4j.Slf4j;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager;
import org.springframework.stereotype.Component;

/**
 * @Auther: 你的名字
 * @Date: 2021/04/19/15:10
 * @Description:
 * synHttpClient工厂类
 */
@Component
@Slf4j
public class AsynHttpClientFactory {
    private static CloseableHttpAsyncClient httpclient;
    private PoolingNHttpClientConnectionManager connManager;
    public AsynHttpClientFactory() {
        connManager = HttpAsyncClientUtil.getConnManager();
        httpclient = HttpAsyncClientUtil.getClient(connManager);
        httpclient.start();
        log.info("异步httpClient启动完成");
    }

    public static CloseableHttpAsyncClient getCloseableHttpAsyncClient(){
        return httpclient;
    }
}
